package gui;

import java.awt.Dialog.ModalityType;

import javax.swing.*;

public class ExceptionHandler {
	public static void handleException(Exception e, String message) {
		JDialog modalDialog = new Notification(e, message);
	}
	
	public static void handleException(Exception e) {
		handleException(e, e.getMessage());
	}
	
	public static String buildStackTraceString(StackTraceElement[] stackTrace) {
		StringBuilder result = new StringBuilder();
		String NEW_LINE = System.getProperty("line.separator");

		for (StackTraceElement element : stackTrace) {
			result.append(element);
			result.append(NEW_LINE);
		}
		
		return result.toString();
	}
}
